// ActionScript file
// ActionScript file
// ActionScript file
package timerstuff {
    import flash.display.Sprite;
    import flash.events.TimerEvent;
    import flash.utils.Timer;

	
	
    public class RandomColorTimer extends Sprite {
    	var i:int = 0;
    	static var colorAry:Array;
        public function RandomColorTimer(ary:Array) 
        {
            var colorTimer:Timer = new Timer(1000, 13);
            colorAry = ary;
            colorTimer.addEventListener(TimerEvent.TIMER, displayColor);
            colorTimer.addEventListener(TimerEvent.TIMER_COMPLETE, selectColor);
            colorTimer.start();
        }
		
		
        public function displayColor(event:TimerEvent):void 
        {
        	//ary[0].visible=false;
        	if (i < 5) {
        		i++;
        	}else {
        		i = 0;
        	}
        	
        	if (i != 0) {
        		colorAry[i-1].visible=false;
        		colorAry[i].visible=true;
        	}
        	
            //trace("tick " + event.target.currentCount);
        }

        public function selectColor(event:TimerEvent):void
        {
            trace("Time's Up!");
        }
    }
}